using Tycho.Parser.Tokens;

namespace Tycho.Parser.Peg {
    public abstract class Terminal<Context> : Production<Context> {
        protected override ParseResult<Context> ReallyParse (Token[] tokens, int index, Context context) {
            if (index < tokens.Length) {
                return ParseTerminal (tokens, index, context);
            } else {
                return null;
            }
        }

        protected abstract ParseResult<Context> ParseTerminal (Token[] tokens, int index, Context context);
    }
}